#!/bin/sh

#in variable PKGS_SPECS_TABLE, file DISTRO_PKGS_SPECS-*, be sure to have dev>exe:
#yes|kbd|kbd|exe,dev>exe,doc,nls

#keyboard layout script expects files to not be gzipped...
FILESGZ="`find ./usr -type f -name \*.gz`"

if [ "$FILESGZ" != "" ];then
 for ONEFILEGZ in $FILESGZ
 do
  gunzip $ONEFILEGZ
 done
fi

#120627 debian and gentoo have different path in usr/share...
[ "`ls -1 usr/share/consolefonts`" = "" ] && rm -rf usr/share/consolefonts
[ "`ls -1 usr/share/keymaps/i386`" = "" ] && rm -rf usr/share/keymaps/i386
[ "`ls -1 usr/share/keymaps/include`" = "" ] && rm -rf usr/share/keymaps/include
[ "`ls -1 usr/share/keymaps`" = "" ] && rm -rf usr/share/keymaps
[ "`ls -1 usr/share/kbd/consolefonts`" = "" ] && rm -rf usr/share/kbd/consolefonts
[ "`ls -1 usr/share/kbd/keymaps/i386`" = "" ] && rm -rf usr/share/kbd/keymaps/i386
[ "`ls -1 usr/share/kbd/keymaps/include`" = "" ] && rm -rf usr/share/kbd/keymaps/include
[ "`ls -1 usr/share/kbd/keymaps`" = "" ] && rm -rf usr/share/kbd/keymaps
[ "`ls -1 usr/share/kbd`" = "" ] && rm -rf usr/share/kbd

#120627 is it ok rename .kmap to .map, better for our scripts...
FILESKMAP="`find ./usr/share -type f -name '*.kmap'`"
if [ "$FILESKMAP" != "" ];then
 for ONEFILEKMAP in $FILESKMAP
 do
  xONEFILEKMAP="$(echo -n "$ONEFILEKMAP" | sed -e 's%\.kmap$%%')"
  rm ${xONEFILEKMAP}.kmap
 done
fi


#=== old kbd template
#
#│   ├── [4.0K]  bin
#│   │   └── [   0]  loadkeys
#│   ├── [1.3K]  FIXUPHACK
#│   └── [4.0K]  usr
#│       ├── [4.0K]  bin
#│       │   └── [   0]  setfont
#│       └── [4.0K]  share
#│           ├── [4.0K]  consolefonts
#│           │   ├── [   0]  lat1-12.psfu
#│           │   ├── [   0]  lat1-12.psfu.gz
#│           │   ├── [   0]  lat2-12.psfu
#│           │   └── [   0]  lat2-12.psfu.gz
#│           ├── [4.0K]  kbd
#│           │   ├── [4.0K]  consolefonts
#│           │   │   ├── [   0]  lat1-12.psfu
#│           │   │   ├── [   0]  lat1-12.psfu.gz
#│           │   │   ├── [   0]  lat2-12.psfu
#│           │   │   └── [   0]  lat2-12.psfu.gz
#│           │   └── [4.0K]  keymaps
#│           │       ├── [4.0K]  i386
#│           │       │   └── [   0]  PLUSEXTRADIRS
#│           │       └── [4.0K]  include
#│           │           └── [   0]  PLUSEXTRAFILES
#│           └── [4.0K]  keymaps
#│               ├── [4.0K]  i386
#│               │   └── [   0]  PLUSEXTRADIRS
#│               └── [4.0K]  include
#│                   └── [   0]  PLUSEXTRAFILES
